//
//  DrawView.m
//  绘制文字和图片
//
//  Created by Justsoso on 16/4/6.
//  Copyright © 2016年 Justsoso. All rights reserved.
//

#import "DrawView.h"

@implementation DrawView

- (void)setSelImage:(UIImage *)selImage
{
    _selImage = selImage;
    
    /* 重绘 */
    [self setNeedsDisplay];
}

// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
    
    /* 1. 绘制图片 */
    /* bundle 中的图片 */
    UIImage *image = [UIImage imageNamed:@"布鲁克.jpg"];
//    [image drawAtPoint:CGPointZero];
    [image drawInRect:CGRectMake(0, 0, 45, 45)];
//    [image drawInRect:rect];
    
    [self.selImage drawInRect:CGRectMake(50, 80, 100, 100)];
    
    NSString *str = @"w dadsasdadasd";
    NSMutableDictionary *textDict = [NSMutableDictionary dictionary];
    textDict[NSForegroundColorAttributeName] = [UIColor greenColor];
    textDict[NSFontAttributeName] = [UIFont systemFontOfSize:15];
    
    NSAttributedString *aStr = [[NSAttributedString alloc] initWithString:@"Hello!" attributes:textDict];
    
    [str drawAtPoint:CGPointMake(100, 25) withAttributes:textDict];
    
    [aStr drawAtPoint:CGPointMake(100, 50)];
}


@end
